# -*- coding: utf-8 -*-
# @Time    : 2021/4/15 0015 18:29
# @Author  : 蒋才果
# @Email   : 1476235300@qq.com
# @File    : 快速排序.py
# @Software: PyCharm
def q_sort(lst):
    less = [];greater = []
    if len(lst) <= 1:
        return lst
        # print(array)
    else:
        dd = lst.pop()
        for x in lst:
            if x <= dd:
                less.append(x)
                # print(less)
            else:
                greater.append(x)
                # print(greater)
        return q_sort(less) + [dd] + q_sort(greater)
if __name__ == '__main__':
    ls = [2,1,5,4,8,3,5]
    print(q_sort(ls))


